//
//  CategoryHViewCell.m
//  JiaoX
//
//  Created by yinqy on 15/1/6.
//  Copyright (c) 2015年 北京娇羞科技有限公司. All rights reserved.
//

#import "CategoryHViewCell.h"
@interface CategoryHViewCell()
{
    UIImageView *_cateImage;
    UILabel *_title;
}
@property (nonatomic,assign)CGFloat cellWidth;
@end
@implementation CategoryHViewCell
+ (instancetype)cellWithTableView:(UICollectionView *)collectionView indexPath:(NSIndexPath *)indexPath cellWidth:(CGFloat)width{
    CategoryHViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CATE_H_IDENTIFIER forIndexPath:indexPath];
    cell.cellWidth = width;
    return cell;
}

-(id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        //添加一个imageView
        UIImageView *cateImage = [[UIImageView alloc]init];
        _cateImage = cateImage;
        [self addSubview:cateImage];
        
        //添加一个uilabel
        UILabel *title = [[UILabel alloc]init];
        title.font = [UIFont systemFontOfSize:[DimensUtils getScaleX:13]];
        title.textColor = JXColor(77, 77, 77);
        title.textAlignment = NSTextAlignmentCenter;
        [self addSubview:title];
        title.backgroundColor = [UIColor clearColor];
        _title = title;
        
        self.backgroundColor = JXColor(240, 240, 240);
    }
    return self;
}

-(void)setImageUrl:(NSString *)url title:(NSString *)title{
    _title.frame = CGRectMake(0, _cellWidth, _cellWidth, TITLE_LABEL_HEIGHT);
    _title.text = title;
    
    _cateImage.frame = CGRectMake(0, 0, _cellWidth,_cellWidth);
    [_cateImage sd_setImageWithURL:[NSURL URLWithString:url]];
}




@end
